feat: improve inline file viewing#102
Conversation
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
DenizAltunkapan
left a comment
There was a problem hiding this comment.
The backend changes here are reasonable: reusing loadAsResource removes duplication and is stricter (it adds a readable check), the ETag and Last-Modified handling is clean, ContentDisposition.inline() is better than manual string building, and the range-response test is a nice end-to-end confirmation. One blocker and a few test gaps before this can go in.
Blocker: this PR sets Closes #98, but #98 is the full workspace file viewer (viewer shell, per-type renderers, actions sidebar, next/previous navigation, unsupported-type fallback UI, loading and error states). This PR is backend only, and the description itself says the frontend viewer shell still needs to be implemented. Merging it would auto-close #98 with almost all of its acceptance criteria still open. Please change Closes #98 to Part of #98 (or point it at a smaller backend-scoped issue) so the viewer work stays tracked.
Separately, the bearer-token point in your notes is worth a dedicated follow-up issue: native
The inline comments cover the test gaps.
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Summary
FileService.loadAsResource()flow.Linked issue
Part of #98
Frontend authentication integration is tracked in Vault-Web/vault-web#281.
How to test
Run the test suite:
Request a supported file:
Verify the response includes the correct
Content-Type,Content-Disposition: inline,ETag, andLast-Modifiedheaders.Send full, open, suffix, and unsatisfiable byte-range requests. Verify valid ranges return
206 Partial ContentwithContent-Range, while an out-of-bounds range returns416.Verify unknown MIME types return
application/octet-stream.Verify traversal and symlink paths outside the authenticated user root are rejected.
Notes / Risk